<?php
session_start();
//session_register('login_state');
//$_SESSION['login_state'] ;
//===========================================================
$path = '../';
include($path."common.php");
include($path."prod_fun.php");
//=========================================================== 
$pageout = "prod_login.php" ; 
if($_SESSION['login_state'] <> "S" and $_SESSION['login_state'] <> "P"){
	gotopage($pageout) ;
} 
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/cart.css" />
<?
$id = $_GET['id'] ;
$nowpage = $_GET['nowpage'] ;
echo "<form method=post id=frm name=frm action=\"prod_act.php?nowpage=$nowpage\">" ;
echo "<table width=300 border=1 align=center cellspacing=1 cellpadding=1>" ;
//===========================================================
$sql_edit = "select * from product where id = '$id' order by id" ;
$result_edit = mysql_query($sql_edit);
$row_edit=mysql_fetch_object($result_edit);
$prodno = $row_edit->id ;
$prodname = $row_edit->name ;
$prodqty = $row_edit->pd_count ;
$prodpric1 = $row_edit->price_1 ;
$prodpric2 = $row_edit->price_2 ;
//===========================================================
echo "<input name=txt1 type=hidden size=20 value='$prodno'>" ;
echo "<tr>" ;
echo "<td align=right>產品名稱:</td>" ;
echo "<td align=left><input name=txt2 type=text size=20 value='$prodname'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>產品數量:</td>" ;
echo "<td align=left><input name=txt3 type=text size=20 value='$prodqty'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>市售價:</td>" ;
echo "<td align=left><input name=txt4 type=text size=20 value='$prodpric1'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>公益價:</td>" ;
echo "<td align=left><input name=txt5 type=text size=20 value='$prodpric2'></td>" ;
echo "</tr>" ;
//===========================================================
echo "<tr>" ;
echo "<td colspan=2>" ;
echo "<table width=100% border=0 align=center cellspacing=1 cellpadding=1>" ;
echo "<tr>" ;
if($id){ 
echo "<td width=50% align=right><input name=action type=submit value='修改'></td>" ;
}else{
echo "<td width=50% align=right><input name=action type=submit value='新增'></td>" ;
}
echo "<td width=50% align=left><input name=action type=submit value='返回清單'></td>" ;
echo "</tr>" ;
echo "</table>" ;
echo "</td>" ;
echo "</tr>" ;
//===========================================================
echo "</table>" ;
//===========================================================
echo "</form>" ;
?>